package com.thinkgem.jeesite.modules.book.entity;

import com.thinkgem.jeesite.common.persistence.DataEntity;
import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField;
import org.apache.commons.lang3.StringUtils;

import java.sql.Timestamp;

/**
 * 书籍编目
 * Created by aulbrother on 2015/11/25.
 */
public class PurchaseLedger extends DataEntity<PurchaseLedger>{
    private String num;
    private Timestamp iptTme;
    private String isbn;
    private String bookname;
    private String author;
    private String banid;
    private String classcode;
    private String place;
    private String amount;
    private String price;
    private String total;
    public PurchaseLedger(){}
    public PurchaseLedger(BkBookstore bookstore){
        this.iptTme = bookstore.getIptTme();
        this.isbn = bookstore.getIsbn();
        this.bookname = bookstore.getBookname();
        this.author = bookstore.getAuthor();
        this.banid = bookstore.getBanid();
        this.classcode = bookstore.getClasscode();
        this.place = bookstore.getPlace();
        this.amount = String.valueOf(bookstore.getAmount());
        this.price = bookstore.getPrice();
        this.total = String.valueOf(Double.parseDouble(price) * Integer.parseInt(amount));
    }

    @ExcelField(title = "序号", type = 0, align = 2, sort = 1)
    public String getNum(){
        return num;
    }

    @ExcelField(title = "验收日期", type = 0, align = 2, sort = 2)
    public Timestamp getIptTme(){
        return iptTme;
    }

    @ExcelField(title = "ISBN", type = 0, align = 2, sort = 3)
    public String getIsbn(){
        return isbn;
    }

    @ExcelField(title = "书名", type = 0, align = 2, sort = 4)
    public String getBookname(){
        return bookname;
    }

    @ExcelField(title = "著者", type = 0, align = 2, sort = 5)
    public String getAuthor(){
        return author;
    }

    public String getBanid(){
        return banid;
    }

    @ExcelField(title = "索书号", type = 0, align = 2, sort = 7)
    public String getBkNumber(){
        if(StringUtils.isNotEmpty(this.classcode)){
            return this.classcode + "/" + this.place;
        }else{
            return "";
        }
    }
    public String getClasscode(){
        return classcode;
    }

    public String getPlace(){
        return place;
    }

    @ExcelField(title = "册数", type = 0, align = 2, sort = 8)
    public String getAmount(){
        return amount;
    }

    @ExcelField(title = "价格", type = 0, align = 2, sort = 9)
    public String getPrice(){
        return price;
    }

    @ExcelField(title = "总价", type = 0, align = 2, sort = 10)
    public String getTotal(){
        return total;
    }

    public void setNum(String num){
        this.num = num;
    }

    public void setIptTme(Timestamp iptTme){
        this.iptTme = iptTme;
    }

    public void setIsbn(String isbn){
        this.isbn = isbn;
    }

    public void setBookname(String bookname){
        this.bookname = bookname;
    }

    public void setAuthor(String author){
        this.author = author;
    }

    public void setBanid(String banid){
        this.banid = banid;
    }

    public void setClasscode(String classcode){
        this.classcode = classcode;
    }

    public void setPlace(String place){
        this.place = place;
    }

    public void setAmount(String amount){
        this.amount = amount;
    }

    public void setPrice(String price){
        this.price = price;
    }
    public String setTotal(String total){
        return this.total = total;
    }
}
